<?php
namespace app\index\controller;
use app\facade\Auth;
use think\Db;

class Config extends Base
{

    public function getConfig(){
//        $datas =  Db::table('tb_article')->where($where)->field("id,title,introduce")->order("time desc")->page($page)->paginate($pageSize);
//        return $this->sendSuccess("获取成功",$datas);
        $status = $this->request->param('status');
        $page= $this->request->param('page');
        $pageSize= $this->request->param('pageSize');
        if (empty($page)){
            $page=1;
        }
        if (empty($pageSize)){
            $pageSize=100;
        }
        $where=[];
        if (!empty($status)){
            $where['type']=$status;
        }
        $datas =  Db::table('tb_config')->where($where)->page($page)->paginate($pageSize);
        return $this->sendSuccess('获取数据成功',$datas);
    }

    public function getArea(){
        $status = $this->request->param('status');
        $page= $this->request->param('page');
        $pageSize= $this->request->param('pageSize');
        if (empty($page)){
            $page=1;
        }
        if (empty($pageSize)){
            $pageSize=100;
        }
        $where=[];
        if (!empty($status)){
            $where['status']=$status;
        }
        $datas =  Db::table('tb_area')->where($where)->page($page)->paginate($pageSize);
        return $this->sendSuccess('获取数据成功',$datas);
    }

    public function getLevels(){
        $datas =  Db::table('tb_mt_level')->select();
        return $this->sendSuccess('获取数据成功',$datas);
    }

    public function sndj(){
        $start =1;
        if ($start){
            return $this->sendSuccess('snjd可以访问');
        }else{
            return $this->sendFail('snjd不可以访问');
        }

    }



}